/**
 * Created by minigci.he on 16/9/12.
 */
console.log('-----------------------')
console.log('test5')



var double = n => n * 2;
var pow = n => n * n;
var reverseInt = n => n.toString().split('').reverse().join('') | 0;

var obj = {
    double: double,
    pow: pow,
    reverseInt: reverseInt
}

var pipe = (function(){
    var pipe;
    return function(value){
        console.log(value);
        pipe = [];
        return new Proxy({}, {
            get: function(pipeObject, fnName){

                if(fnName == 'get'){
                    return pipe.reduce(function(val, fn){
                        return fn(val);
                    }, value)
                }


                pipe.push(obj[fnName]);
                return pipeObject;
            }
        })
    }
}())
// console.log(pipe(3).double.pow.get);

